package com.amorcloud.pig.utils;

import com.amorcloud.pig.MyApp;
import com.amorcloud.pig.bean.PigInfoBean;

import java.util.List;

public class PigDaoUtils {

    public static long insertPigInfo(PigInfoBean bean) {
        return MyApp.getDaoInstant().getPigInfoBeanDao().insert(bean);
    }

    public static PigInfoBean queryById(String id) {
        return queryWhere("where ID=?", id).get(0);
    }

    public static List<PigInfoBean> queryAll() {
        return MyApp.getDaoInstant().getPigInfoBeanDao().loadAll();
    }

    public static List<PigInfoBean> queryWhere(String where, String ... param) {
        return MyApp.getDaoInstant().getPigInfoBeanDao().queryRaw(where, param);
    }

    public static void update(PigInfoBean pigInfoBean) {
        MyApp.getDaoInstant().getPigInfoBeanDao().update(pigInfoBean);
    }

    public static void delete(PigInfoBean bean) {
        MyApp.getDaoInstant().getPigInfoBeanDao().delete(bean);
    }

}
